package com.itkongxiaoyi.controller;

import com.itkongxiaoyi.entity.ResultBatch;
import com.itkongxiaoyi.service.StudentBatchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
public class StudentBatchController {
    @Autowired
    private StudentBatchService studentBatchService;

    @PostMapping("/api/student/imports")
    public ResultBatch importStudentInfo(@RequestParam("file") MultipartFile file) {
        int count = studentBatchService.importStudents(file);
        return ResultBatch.success("学生基本信息导入成功", count);
    }

}
